<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/page/public/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资源日志</title>
	<% request.setAttribute("menu", 1); %>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <%@ include file="/WEB-INF/page/public/contentmeta.jsp"%>
    <link rel="stylesheet" href="<%=basePath%>plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="<%=basePath%>css/global.css" media="all" />
    <link rel="stylesheet" href="<%=basePath%>plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="<%=basePath%>css/tab.css" media="all" />
</head>
<body>

<div class="admin-tab admin-user admin-transform">
    <div class="tab-condition">
        <form class="layui-form clefix" action="/customer/resourceslogurl" method="post" id="transformform">
            <div class="layui-form-item">
            	<div class="layui-input-inline">
	                  	<input type="text" name="keyWord" id="keyWord" class="layui-input" placeholder="请输入关键字"  style="width:100%" value="${pager.params.keyWord}"> 
	            </div>
            	<div class="layui-input-inline">
                    <select name="state" id="state" lay-filter="state" class="stateclass">
                    	<option value="">请选择日志类型</option>
                    	<option value="-1" <c:if test="${pager.params.state == -1}">selected</c:if>>全部</option>
                        <option value="0" <c:if test="${pager.params.state == 0}">selected</c:if>>获取</option> 
                        <option value="1" <c:if test="${pager.params.state == 1}">selected</c:if>>放弃</option>
                        <option value="2" <c:if test="${pager.params.state == 2}">selected</c:if>>录入</option>
                        <%-- <option value="3" <c:if test="${pager.params.state == 3}">selected</c:if>>修改</option> --%> 
                        <option value="4" <c:if test="${pager.params.state == 4}">selected</c:if>>索要</option> 
                        <option value="5" <c:if test="${pager.params.state == 5}">selected</c:if>>分配</option> 
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="category" id="category" lay-filter="category" class="typeclass">
                        <option value="">请客户类型</option>
                        <option value="-1" <c:if test="${pager.params.category == -1}">selected</c:if>>全部</option>
                        <option value="1" <c:if test="${pager.params.category == 1}">selected</c:if>>企业</option>
                        <option value="0" <c:if test="${pager.params.category == 0}">selected</c:if>>个人</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
            	<input name="skipToPage" id="skipToPage"  type="hidden" value="${pager.pageNo}">
				<input type="hidden" id="pageNo" name="pageNo" value="${pager.pageNo}">
				<input type="hidden" id="totalPage" name="totalPage" value="${pager.totalPages}">
				<input type="hidden" id="pageSize" name="pageSize" value="${pager.pageSize}">
                <button class="layui-btn search" type="button" lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i>搜索</button>
            </div>
        </form>
        <div class="TM-tab-info">
            <a class="layui-btn layui-btn-primary layui-btn-small refreshbtn"><i class="layui-icon">&#x1002;</i>刷新</a>
        </div>
    </div>
    <div class="layui-field-box">
        <table class="site-table table-hover TM-user TM-table3">
            <thead>
            <tr>
                <th style="width:5%"><input type="checkbox" id="selected-all"/></th>
                  <th style="width:20%">资源名称</th>
                 <th style="width:40%">日志描述</th>
                <th style="width:10%">日志类型</th>
                <th style="width:10%">客户类型</th>
                <th style="width:10%">创建时间</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="obj" items="${pager.resultList}">
            	<tr data="${obj.id}">
            		<td><input type="checkbox" name="select-all-cbox" value="${obj.id}"/></td>
            		<td>${obj.contentname}</td>
            		<td>${obj.description}</td>
            		<td><dic:logstate value="${obj.state}"/></td>
            		<td>
            			<c:if test="${obj.category == 0}">
            				个人
            			</c:if>
            			<c:if test="${obj.category == 1}">
            				企业
            			</c:if>
            		</td>
            	
            		<td>${obj.createdate}</td>
            		<!-- <td></td> -->
            	</tr>
            </c:forEach>
            </tbody>
        </table>
        <div class="admin-table-page">
            <div id="page" class="page"></div>
        </div>
    </div>
</div>

<script>

	layui.use(['icheck','element','laypage','form','laydate'],function(){
		
		var $ = layui.jquery,
        layer = layui.layer,
        laypage = layui.laypage;
        var form = layui.form();
        
        //input的全选与取消全选
        $("#selected-all").on("click",function(){
        	if ($("#selected-all").is(":checked")){
        		$("[name='select-all-cbox']").prop("checked",true);
        	} else {
        		$("[name='select-all-cbox']").prop("checked",false);
        	}
        });
        
    	//点击查看
    	$(".find-btn").on("click",function(){
    		var id = $(this).parent().parent().attr("data");
    		var url = "/customer/findcustomer"+id;
    		window.open(url);
    	});
    	
        var pageNo = $("#pageNo").val();
    	var totalPage = $("#totalPage").val();
		//分页按钮
    	laypage({
            cont: 'page',
            curr: pageNo//'${pager.pageNo}'
            ,pages: totalPage//'${pager.totalPages}' //总页数
            ,
            groups: 5 //连续显示分页数
            ,
            skip: true,
            jump: function(obj, first) {
                //得到了当前页，用于向服务端请求对应数据
                var curr = obj.curr;
                if(!first) {
                	$("#skipToPage").val(curr);
                	$("#transformform").submit();
                }
            }
        }); 
		
    	//点击搜索
		$(".search").on("click",function(){
			$("#pageNo").val(1);
			$("#skipToPage").val(1);
			$("#transformform").submit();
		});
	});





</script>

</body>
</html>